package com.example.basefream.controller;

import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import com.example.basefream.config.DevConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ：Mr-L
 * @date ：Created in 2022/4/12 15:10
 * @description：测试apollo配置中心
 * @modified By：
 * @version: v1$
 */
@RestController
@RequestMapping("/test")
@EnableApolloConfig
public class ApolloTestController {

    @Resource
    DevConfig devConfig;

    @Value("${test}")
    private String test;

    @Value("${dev.name}")
    private String name;

    @RequestMapping("/apollo")
    public String apollo() {
        return "value " + name +  ",test" + test;
    }



    @RequestMapping("/apolloS")
    public String apolloS() {
        return  "devConfig:" + devConfig.getName();
    }

}
